<template>
	<view class="wrap">
		<view class="topVue">
			<view class="status"></view>
			<view class="navVue">
				<image src="../../static/imgs/back.png" style="width: 36rpx; height: 36rpx;" @click="backFun"></image>
				
				<view class="nav-title">{{ currency }}/USDT{{$t('专业版')}}</view>
				<view style="width: 36rpx; height: 36rpx;"></view>	
			</view>
		</view>
		
		<view class="place"></view>
	
		<view class="box">
			<view class="label">
				<text>{{$t('自定义百分比间隔')}}：</text>
				<view class="right">
					<u--input v-model="form.interval" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
			<view class="label">
				<text>{{$t('追踪建仓比例')}}：</text>
				<view class="right">
					<u--input v-model="form.traceRate" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
			<view class="label">
				<text>{{$t('整体止盈比例')}}：</text>
				<view class="right">
					<u--input v-model="form.overWinRate" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
			<view class="label">
				<text>{{$t('追踪止盈回降比例')}}：</text>
				<view class="right">
					<u--input v-model="form.overLossRate" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
			<view class="label">
				<text>{{$t('网格止盈比例')}}：</text>
				<view class="right">
					<u--input v-model="form.gridWinRate" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
			<view class="label">
				<text>{{$t('网格追踪止盈比例')}}：</text>
				<view class="right">
					<u--input v-model="form.gridLossRate" :placeholder="$t('请输入')" placeholderStyle="{color: #999999}"></u--input>
					<text class="ratio">%</text>
				</view>
			</view>
		</view>

		<view class="btns">
			<u-button class="close" type="primary" :text="$t('取消')" @click="close"></u-button>
			<u-button type="primary" :text="$t('生成表单')" @tap="submint"></u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					interval: "1.2",
					traceRate: "0.3",
					overWinRate: "2",
					overLossRate: "0.5",
					gridWinRate: "1",
					gridLossRate: "0.3",
				},
				id: null,
				currency: null,
			};
		},
		methods: {
			close() {
				uni.navigateBack();
			},
			backFun(){
				uni.navigateBack({
					delta: 1
				})
			},
			submint() {
				let a = 0;
				for (let key in this.form) {
					if (!!this.form[key]) {
						a++;
					}
				}
				if (a < 1) {
					uni.$u.toast(this.$t("请先完成表单填写"));
				} else {
					let params = {
						id: this.id,
						...this.form,
					};
					uni.navigateTo({
						url: `/pages/set/strategy-set-table?form=${encodeURIComponent(
            JSON.stringify(params)
          )}`,
					});
				}
			},
		},
		onLoad(options) {
			this.id = options.id;
			this.currency = options.currency;
		},
	};
</script>

<style lang="scss" scoped>
	.wrap {
		width: 100%;
		height: 100%;
		background: url("../../static/imgs/bg.png") no-repeat;
		background-size: 100% 100%;
		box-sizing: border-box;
		position: fixed;
		.place {
			height: calc(var(--status-bar-height) + 92rpx);
		}
		
		.topVue {
			width: 100%;
			position: absolute;
			left: 0;
			top: 0;
			z-index: 99;
			.status {
				width: 100%;
				height: var(--status-bar-height);
			}
			.navVue {
				width: 100%;
				height: 92rpx;
				background: linear-gradient(to right, #FFFBFF, #FFE7F4);
				display: flex;
				justify-content: space-between;
				align-items: center;
				box-sizing: border-box;
				padding: 0 30rpx;
				.nav-title {
					width: 420rpx;
					height: 92rpx;
					font-size: 36rpx;
					color: #04094C;
					text-align: center;
					line-height: 92rpx;
				}
			}
		}

		.title {
			padding: 40rpx 22rpx 35rpx 30rpx;
			margin-bottom: 45rpx;
			font-size: $uni-font-size-36;
			background: #1d1f31;
			border-radius: $border-radius-20;
		}

		.box {
			width: 690rpx;
			padding: 30rpx;
			margin-bottom: 10rpx;
			background: #fff;
			border-radius: $border-radius-20;
			box-sizing: border-box;
			margin: 20rpx auto 0;
			.label {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 25rpx;

				.right {
					display: flex;
					align-items: center;
				}

				/deep/ .u-input {
					width: 140rpx;
					flex: none;
					margin-right: 20rpx;
					border-color: transparent !important;
					background: #f5f5f5;
					border-radius: 10px;

					.uni-input-input {
						color: #333;
					}
				}
			}
		}

		.btns {
			display: flex;
			justify-content: center;
			align-items: center;
			margin: 100rpx 0;
			font-size: $uni-font-size-30;

			.u-button {
				width: 280rpx;
				height: 80rpx;
				border: 1rpx solid #D55B94;
				background-color: #D55B94;
				border-radius: $border-radius-20;
			}

			.close {
				background: #f5f5f5;
				color: #333;
				border: none;
			}
		}
	}
</style>